home *** CD-ROM | disk | FTP | other *** search
- #!/usr/bin/perl
-
- use strict;
- use warnings;
-
- #man{{{
-
- =head1 NAME
-
- tails-virt-notify-user
-
- =head1 VERSION
-
- Version X.XX
-
- =head1 AUTHOR
-
- Tails dev team <amnesia@boum.org>
- See https://tails.boum.org/.
-
- =cut
-
- #}}}
-
- use Carp;
- use Desktop::Notify;
- use Fatal qw( open close );
- use Locale::gettext;
- use POSIX;
-
- ### initialization
- setlocale(LC_MESSAGES, "");
- textdomain("tails-virt-notify-user");
- my $detected_virt_file='/var/lib/live/detected-virtual-machine';
-
- ### main
-
- exit 0 unless -e $detected_virt_file;
-
- my @detected_virt;
-
- open my $detected_virt_file_h, '<', $detected_virt_file;
- while (my $detected_virt = <$detected_virt_file_h>) {
- chomp $detected_virt;
- push @detected_virt, $detected_virt;
- }
- close $detected_virt_file_h;
-
- exit 0 unless @detected_virt;
-
- my $notify = Desktop::Notify->new();
-
- my $summary = gettext("Warning: virtual machine detected!");
- my $body =
- gettext("Both the host operating system and the virtualization software are able to monitor what you are doing in Tails.")
- . " "
- . gettext("<a href='file:///usr/share/doc/tails/website/doc/advanced_topics/virtualization.en.html'>Learn more...</a>")
- . " "; # Workaround: else the last line of the notification is not displayed
-
- $notify->create(summary => $summary,
- body => $body,
- timeout => 0)->show();
-